home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{3035B5D2-295D-11D3-8C54-006008BA8D16}#1.0#0"; "MAGICTCP.OCX"
- Begin VB.Form Form1
- Caption = "Form1"
- ClientHeight = 6150
- ClientLeft = 60
- ClientTop = 345
- ClientWidth = 8475
- LinkTopic = "Form1"
- ScaleHeight = 6150
- ScaleWidth = 8475
- StartUpPosition = 3 'Windows-Standard
- Begin VB.TextBox txtLocalPort
- Height = 285
- Left = 1200
- TabIndex = 7
- Top = 720
- Width = 735
- End
- Begin VB.TextBox txtOutput
- Height = 4095
- Left = 120
- MultiLine = -1 'True
- ScrollBars = 3 'Beides
- TabIndex = 0
- TabStop = 0 'False
- Top = 1920
- Width = 8295
- End
- Begin VB.TextBox txtInput
- Height = 285
- Left = 1200
- TabIndex = 1
- Top = 1200
- Width = 7215
- End
- Begin VB.TextBox txtPort
- Height = 285
- Left = 5400
- TabIndex = 3
- Text = "5555"
- Top = 240
- Width = 735
- End
- Begin VB.TextBox txtHost
- Height = 285
- Left = 1200
- TabIndex = 2
- Text = "localhost"
- Top = 240
- Width = 2655
- End
- Begin VB.Label Label5
- Caption = "Received Text"
- Height = 255
- Left = 120
- TabIndex = 9
- Top = 1680
- Width = 1455
- End
- Begin VB.Label Label4
- Caption = "Send Text"
- Height = 255
- Left = 120
- TabIndex = 8
- Top = 1200
- Width = 855
- End
- Begin VB.Label Label3
- Caption = "Local Port"
- Height = 255
- Left = 120
- TabIndex = 6
- Top = 720
- Width = 855
- End
- Begin VB.Label Label2
- Caption = "Remote Port"
- Height = 255
- Left = 4320
- TabIndex = 5
- Top = 240
- Width = 975
- End
- Begin VB.Label Label1
- Caption = "Remote Host"
- Height = 255
- Left = 120
- TabIndex = 4
- Tag = "Re"
- Top = 240
- Width = 975
- End
- Begin M3LibCtl.MagicTCP M1
- Left = 6960
- OleObjectBlob = "UDP1.frx":0000
- Top = 120
- End
- Begin VB.Line Line1
- X1 = 120
- X2 = 8400
- Y1 = 1080
- Y2 = 1080
- End
- Attribute VB_Name = "Form1"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- Const K_SECTION = "UPDCHAT"
- Const K_REMOTEHOST = "REMOTEHOST"
- Const K_REMOTEPORT = "REMOTEPORT"
- Const K_LOCALPORT = "LOCALPORT"
- Private Sub Text2_Change()
- End Sub
- Private Sub Form_Load()
- With M1
- .Type = 2 ' UDP
- txtHost = .GetProfileString(K_SECTION, K_REMOTEHOST, "192.168.1.11")
- txtPort = CStr(.GetProfileInt(K_SECTION, K_REMOTEPORT, 3333))
- txtLocalPort = CStr(.GetProfileInt(K_SECTION, K_LOCALPORT, 3333))
- .RemoteHost = txtHost
- .RemotePort = txtPort
- .LocalPort = CLng(txtLocalPort)
- If Not .Bind Then
- MsgBox "BIND-Error: " & .LastErrorText
- End
- End If
- End With
- End Sub
- Private Sub m1_OnRead()
- Dim s As String
- With M1
- If .ReadString(s) Then
- txtOutput = txtOutput & .FromHost & ":" & .FromPort & " " & s & vbCrLf
- Else
- MsgBox "Read-Error: " & .LastErrorText
- End If
- End With
- End Sub
- Private Sub txtHost_LostFocus()
- With M1
- .RemoteHost = LCase$(Trim$(txtHost))
- .SetProfileString K_SECTION, K_REMOTEHOST, .RemoteHost
- End With
- End Sub
- Private Sub txtInput_KeyPress(KeyAscii As Integer)
- If KeyAscii = 13 Then
- With M1
- If .WriteString(txtInput) < Len(txtInput) Then
- MsgBox "Write-Error: " & .LastErrorText
- Else
- txtInput = ""
- End If
- End With
- End If
- End Sub
- Private Sub txtLocalPort_LostFocus()
- Dim p As Long
- With M1
- p = CLng(Trim$(txtLocalPort))
- If p <> .LocalPort Then
- .Close
-
- .Type = 2 ' UDP
- .LocalPort = p
- If .Bind Then
- .SetProfileInt K_SECTION, K_REMOTEPORT, p
- Else
- MsgBox "Bind-Error: " & .LastErrorText
- End If
- End If
- End With
- End Sub
- Private Sub txtPort_LostFocus()
- With M1
- .RemotePort = CLng(Trim$(txtPort))
- .SetProfileInt K_SECTION, K_REMOTEPORT, .RemotePort
- End With
- End Sub
-